package com.guangyunl.a_scanner;

import java.util.Scanner;

public class Demo03Scanner {
    public static void main(String[] args) {
        // 创建对象
        Scanner sc = new Scanner(System.in);
        //录入数据
        System.out.print("输入数据: ");
        // 变量名.next() 遇到空格或回车结束录入
        String data1 = sc.next();
        System.out.println("data1 = " + data1);
        // 变量名.nextLine() 遇到回车结束录入
        String data2 = sc.nextLine();
        System.out.println("data2 = " + data2);
        int lengthData2 = data2.length();
        System.out.println("lengthData2的长度 = " + lengthData2);
    }
}
